#!/usr/bin/perl
#delete_folder.cgi

require './folderman-lib.pl';

&ReadParse();
my $loc = $in{'locate'};
my $mntroot = &get_mnt_root;
if ( $in{'dir'} !~ /^$mntroot.+\/.+/)
{
	&nas_syslog("folderman", "naslog_warning", 30008, "Directory invalid!");
	&error($text{'dir_invalid'});
}

if ( !(-d $in{'dir'}))
{
	&nas_syslog("folderman", "naslog_warning", 30009, "Directory invalid!");
	&error($text{'dir_invalid'});
}	

ez_system("rm", "-fr", $in{'dir'});
&nas_syslog("folderman", "naslog_info", 30005, "Delete folder $in{'dir'} success!");
&redirect("index.cgi?dir=$loc");

#&header($text{'delete_folder'}, "");
#print "<hr>\n";
#print &text('delete_folder_ok', $in{'dir'});

#print "<hr>\n";
#&footer("index.cgi?dir=$loc",  $text{'list_folders_return'});
